#!/usr/bin python
# mode选择，扫描时候指定mode，节省时间
from plugins.config import config_check


def mode_list():
    mode_list = '''
+-------------+----------+---------+
|  Mode Name  |  KeyWord |  PoCNum |
+-------------+----------+---------+
|  SeeyonOA   |  seeyon  |    10   | 
+-------------+----------+---------+
|  Apache     |  apache  |    01   |
+-------------+----------+---------+
|  ThinkPHP   |  thinkphp|    12   |
+-------------+----------+---------+
|  Weblogic   |  weblogic|    03   |
+-------------+----------+---------+
|  Some CVE   |  cve     |    06   |
+-------------+----------+---------+
|  Jboss      |  jboss   |    01   |
+-------------+----------+---------+
|  DEdeCMS    |  dedecms |    04   |
+-------------+----------+---------+
|  TongDa OA  |  tongda  |    01   |
+-------------+----------+---------+
|  ApacheS2   |  struts  |    02   |
+-------------+----------+---------+
|  Druid      |  druid   |    01   |
+-------------+----------+---------+
|  MS15-034   |  15034   |    01   |
+-------------+----------+---------+
|  Web Burte  |  brute   |    01   |
+-------------+----------+---------+
|  All        |  all     |    43   |
+-------------+----------+---------+
    '''
    print(mode_list)

def choose_mode(mode,url):

    if mode == 'seeyon':
        print("[*] Checking Vul {} Using Mode: Seeyon\n".format(url))
        config_check.check_seeyon(url)
    if mode == 'apache':
        print("[*] Checking Vul {} Using Mode: Apache\n".format(url))
        config_check.check_apache(url)
    if mode == 'thinkphp':
        print("[*] Checking Vul {} Using Mode: ThinkPHP\n".format(url))
        config_check.check_thinkphp(url)
    if mode == 'weblogic':
        print("[*] Checking Vul {} Using Mode: Weblogic\n".format(url))
        config_check.check_weblogic(url)
    if mode == 'cve':
        print("[*] Checking Vul {} Using Mode: CVE\n".format(url))
        config_check.check_cve(url)
    if mode == 'jboss':
        print("[*] Checking Vul {} Using Mode: Jboss\n".format(url))
        config_check.check_jboss(url)
    if mode == 'dedecms':
        print("[*] Checking Vul {} Using Mode: DedeCMS\n".format(url))
        config_check.check_dedecms(url)
    if mode == 'tongda':
        print("[*] Checking Vul {} Using Mode: Tongda OA\n".format(url))
        config_check.check_tongda(url)
    if mode == 'struts':
        print("[*] Checking Vul {} Using Mode: Apache Struts2\n".format(url))
        config_check.check_struts(url)
    if mode == 'druid':
        print("[*] Checking Vul {} Using Mode: Apache Druid\n".format(url))
        config_check.check_druid(url)
    if mode == '15034':
        print("[*] Checking Vul {} Using Mode: MS15034\n".format(url))
        config_check.check_ms15034(url)
    if mode == 'brute':
        print("[*] Checking Vul {} Using Mode: Web Brute\n".format(url))
        config_check.check_web_brute(url)
    if mode == 'list':
        mode_list()
    if mode == 'all':
        config_check.check_all(url)
